<%@ page language="java"
	import="com.byxy.model.BasicInfo, com.byxy.service.BasicInfoServiceImpl, com.byxy.util.DateUtil"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>update.jsp</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="Styles/bootstrap.min2.css" />


<script language="javascript">
	function chkads() {
		if (lf_addstu.txtid.value == "") {
			alert("编号不能为空.");
			lf_addstu.txtid.select();
			return false;
		}
		if (!IsNum(lf_addstu.txtid.value)) {
			alert("编号请输入数字!")
			lf_addstu.txtid.focus();
			return false;
		}
		if (!IsNum(lf_addstu.txtcontactNumber.value)) {
			alert("联系电话请输入数字!")
			lf_addstu.txtcontactNumber.focus();
			return false;
		}
		if (lf_addstu.txtcontactNumber.value == "") {
			alert("联系电话不能为空.");
			lf_addstu.txtcontactNumber.select();
			return false;
		}
		if (lf_addstu.txtname.value == "") {
			alert("姓名不能为空.");
			lf_addstu.txtname.select();
			return false;
		}

		if (lf_addstu.txtsex.value == "") {
			alert("性别不能为空.");
			lf_addstu.txtsex.select();
			return false;
		}
		if (lf_addstu.txtfamilyName.value == "") {
			alert("民族不能为空.");
			lf_addstu.txtfamilyName.select();
			return false;
		}
		if (lf_addstu.txtplaceOfBirth.value == "") {
			alert("籍贯不能为空.");
			lf_addstu.txtplaceOfBirth.select();
			return false;
		}

		if (!IsNum(lf_addstu.txtqqNumber.value)) {
			alert("QQ号请输入数字!")
			lf_addstu.txtqqNumber.focus();
			return false;
		}
		if (lf_addstu.txtqqNumber.value == "") {
			alert("QQ号不能为空.");
			lf_addstu.txtqqNumber.select();
			return false;
		}
		if (lf_addstu.txtbirthday.value == "") {
			alert("出生年月不能为空.");
			lf_addstu.txtbirthday.select();
			return false;
		}
		if (lf_addstu.txteducation.value == "") {
			alert("学历不能为空.");
			lf_addstu.txteducation.select();
			return false;
		}
		if (lf_addstu.txtpost.value == "") {
			alert("党内职务不能为空.");
			lf_addstu.txtpost.select();
			return false;
		}
		if (lf_addstu.txtworkHours.value == "") {
			alert("参加工作时间不能为空.");
			lf_addstu.txtworkHours.select();
			return false;
		}
		if (lf_addstu.txtpartyHours.value == "") {
			alert("入党时间不能为空.");
			lf_addstu.txtpartyHours.select();
			return false;
		}
		if (lf_addstu.txtpositiveHours.value == "") {
			alert("转正时间不能为空.");
			lf_addstu.txtpositiveHours.select();
			return false;
		}
		if (lf_addstu.txttransitHours.value == "") {
			alert("转入时间不能为空。");
			lf_addstu.txttransitHours.select();
			return false;
		}
		if (lf_addstu.txtdomicileLocation.value == "") {
			alert("户籍所在地不能为空。");
			lf_addstu.txtdomicileLocation.select();
			return false;
		}
		if (lf_addstu.txtidNumber.value == "") {
			alert("身份证号不能为空。");
			lf_addstu.txtidNumber.select();
			return false;
		}
		if (lf_addstu.txtrollOutHours.value == "") {
			alert("转出时间不能为空。");
			lf_addstu.txtrollOutHours.select();
			return false;
		}
	}
	function IsNum(num) {
		var reNum = /^\d*$/;
		return (reNum.test(num));
	}
</script>
</head>

<body>
	<%
		int id = Integer.parseInt(request.getParameter("id"));
		BasicInfoServiceImpl basicSer = new BasicInfoServiceImpl();
		BasicInfo basic = basicSer.findById(id);
	%>
	<h1>时间格式：yyyy-MM-dd</h1>
	<h2>例如：2017-01-01</h2>
	<p>根据编号修改对应信息</p>

	<form action="./BasicInfoUpdaetServlet" method="post"
		onSubmit="return chkads()" name="lf_addstu">
		<table class="table table-striped table-bordered table-condensed list">
			<tr>
				<td>编号：</td>
				<td>姓名：</td>
				<td>性别：</td>
				<td>民族：</td>
				<td>籍贯：</td>
			</tr>
			<tr class="demo">
				<td><input type="text" name="txtid" value="<%=basic.getId()%>" readonly /></td>
				<td><input type="text" name="txtname"
					value="<%=basic.getName()%>" /></td>
				<td><input type="text" name="txtsex"
					value="<%=basic.getSex()%>" /></td>
				<td><input type="text" name="txtfamilyName"
					value="<%=basic.getFamilyName()%>" /></td>
				<td><input type="text" name="txtplaceOfBirth"
					value="<%=basic.getPlaceOfBirth()%>" /></td>


			</tr>
			<tr>
				<td>出生年月：</td>
				<td>学历：</td>
				<td>党内职务：</td>
				<td>参加工作时间：</td>
				<td>入党时间：</td>
			</tr>
			<tr class="demo">
				<td><input type="text" name="txtbirthday"
					value="<%=DateUtil.utilDateTosqlDate(basic.getBirthday())%>" /></td>
				<td><input type="text" name="txteducation"
					value="<%=basic.getEducation()%>" /></td>
				<td><input type="text" name="txtpost"
					value="<%=basic.getPost()%>" /></td>
				<td><input type="text" name="txtworkHours"
					value="<%=DateUtil.utilDateTosqlDate(basic.getWorkHours())%>" /></td>
				<td><input type="text" name="txtpartyHours"
					value="<%=DateUtil.utilDateTosqlDate(basic.getPartyHours())%>" /></td>


			</tr>
			<tr>
				<td>转正时间：</td>
				<td>正式/预备：</td>
				<td>转入时间：</td>
				<td>转入前党支部：</td>
				<td>户籍所在地：</td>
			</tr>
			<tr class="demo">
				<td><input type="text" name="txtpositiveHours"
					value="<%=DateUtil.utilDateTosqlDate(basic.getPositiveHours())%>" /></td>
					<td>
				<%
					if (basic.isStatus() == false) {
				%>
				<input type="radio" name="txtstatus" value="true" />正式&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" name="txtstatus" value=false checked />预备
				<%
					} else {
				%>
				<input type="radio" name="txtstatus" value="true" checked />正式&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" name="txtstatus" value=false />预备
				<%
					}
				%>
				</td>
				<td><input type="text" name="txttransitHours" value="<%=DateUtil.utilDateTosqlDate(basic.getTransitHours())%>" /></td>
				<td><input type="text"
					name="txttransferredToTheFormerPartyBranch" value="<%=basic.getTransferredToTheFormerPartyBranch()%>" /></td>
				<td><input type="text" name="txtdomicileLocation" value="<%=basic.getDomicileLocation()%>" /></td>
			</tr>
			<tr>
				<td>身份证号：</td>
				<td>联系电话：</td>
				<td>QQ号：</td>
				<td>微信号：</td>
				<td>转出时间：</td>
			</tr>
			<tr class="demo">
				<td><input type="text" name="txtidNumber" value="<%=basic.getIdNumber()%>" /></td>
				<td><input type="text" name="txtcontactNumber" value="<%=basic.getContactNumber()%>" /></td>
				<td><input type="text" name="txtqqNumber" value="<%=basic.getQqNumber()%>" /></td>
				<td><input type="text" name="txtwechatNumber" value="<%=basic.getWechatNumber()%>" /></td>
				<td><input type="text" name="txtrollOutHours" value="<%=DateUtil.utilDateTosqlDate(basic.getRollOutHours())%>" /></td>
			</tr>
			<tr>
				<td>转出党支部名称：</td>
				<td>入党介绍人：</td>
				<td>备注：</td>
				<td colspan="2">部门编号：</td>

			</tr>
			<tr class="demo">
				<td><input type="text" name="txtnameOfPartyBranch" value="<%=basic.getNameOfPartyBranch()%>" /></td>
				<td><input type="text" name="txtsponsor" value="<%=basic.getSponsor()%>" /></td>
				<td><input type="text" name="txttext" value="<%=basic.getText()%>" /></td>
				<td colspan="2"><input type="text" name="txtdepartmentId" value="<%=basic.getDepartmentId()%>" /></td>

			</tr>
			<tr>
				<td colspan="6"><input class="btn btn-inverse" type="submit"
					name="input" value="修改" />
				<a href="#" type=”button” name=”submit”
			onclick="javascript:history.back(-1);">返回上一页</a></td>
			</tr>
		</table>
	</form>
</body>
</html>
